package com.hunliji.monitor.web.model.param;

import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * File：GitLabNoteHookParam.java<br> Title: <br> Description: <br>
 *
 * @author lejin Date: 2023/7/25
 */
@NoArgsConstructor
@Data
public class GitLabNoteHookParam {

    private String object_kind;
    private String event_type;
    private UserBean user;
    private Integer project_id;
    private ProjectBean project;
    private ObjectAttributesBean object_attributes;
    private RepositoryBean repository;
    private MergeRequestBean merge_request;

    @NoArgsConstructor
    @Data
    public static class UserBean {

        private Integer id;
        private String name;
        private String username;
        private String avatar_url;
        private String email;
    }

    @NoArgsConstructor
    @Data
    public static class ProjectBean {

        private Integer id;
        private String name;
        private String description;
        private String web_url;
        private Object avatar_url;
        private String git_ssh_url;
        private String git_http_url;
        private String namespace;
        private Integer visibility_level;
        private String path_with_namespace;
        private String default_branch;
        private String ci_config_path;
        private String homepage;
        private String url;
        private String ssh_url;
        private String http_url;
    }

    @NoArgsConstructor
    @Data
    public static class ObjectAttributesBean {

        private Object attachment;
        private Integer author_id;
        private ChangePositionBean change_position;
        private Object commit_id;
        private String created_at;
        private String discussion_id;
        private Integer id;
        private String line_code;
        private String note;
        private Integer noteable_id;
        private String noteable_type;
        private OriginalPositionBean original_position;
        private PositionBean position;
        private Integer project_id;
        private Object resolved_at;
        private Object resolved_by_id;
        private Object resolved_by_push;
        private Object st_diff;
        private Boolean system;
        private String type;
        private String updated_at;
        private Object updated_by_id;
        private String description;
        private String url;

        @NoArgsConstructor
        @Data
        public static class ChangePositionBean {

            private Object base_sha;
            private Object start_sha;
            private Object head_sha;
            private Object old_path;
            private Object new_path;
            private String position_type;
            private Object old_line;
            private Object new_line;
            private Object line_range;
        }

        @NoArgsConstructor
        @Data
        public static class OriginalPositionBean {

            private String base_sha;
            private String start_sha;
            private String head_sha;
            private String old_path;
            private String new_path;
            private String position_type;
            private Object old_line;
            private Integer new_line;
            private LineRangeBean line_range;

            @NoArgsConstructor
            @Data
            public static class LineRangeBean {

                private StartBean start;
                private EndBean end;

                @NoArgsConstructor
                @Data
                public static class StartBean {

                    private String line_code;
                    private String type;
                    private Object old_line;
                    private Integer new_line;
                }

                @NoArgsConstructor
                @Data
                public static class EndBean {

                    private String line_code;
                    private String type;
                    private Object old_line;
                    private Integer new_line;
                }
            }
        }

        @NoArgsConstructor
        @Data
        public static class PositionBean {

            private String base_sha;
            private String start_sha;
            private String head_sha;
            private String old_path;
            private String new_path;
            private String position_type;
            private Object old_line;
            private Integer new_line;
            private Object line_range;
        }
    }

    @NoArgsConstructor
    @Data
    public static class RepositoryBean {

        private String name;
        private String url;
        private String description;
        private String homepage;
    }

    @NoArgsConstructor
    @Data
    public static class MergeRequestBean {

        private Object assignee_id;
        private Integer author_id;
        private String created_at;
        private String description;
        private Object head_pipeline_id;
        private Integer id;
        private Integer iid;
        private Object last_edited_at;
        private Object last_edited_by_id;
        private Object merge_commit_sha;
        private Object merge_error;
        private MergeParamsBean merge_params;
        private String merge_status;
        private Object merge_user_id;
        private Boolean merge_when_pipeline_succeeds;
        private Object milestone_id;
        private String source_branch;
        private Integer source_project_id;
        private Integer state_id;
        private String target_branch;
        private Integer target_project_id;
        private Integer time_estimate;
        private String title;
        private String updated_at;
        private Object updated_by_id;
        private String url;
        private SourceBean source;
        private TargetBean target;
        private LastCommitBean last_commit;
        private Boolean work_in_progress;
        private Integer total_time_spent;
        private Integer time_change;
        private Object human_total_time_spent;
        private Object human_time_change;
        private Object human_time_estimate;
        private List<?> assignee_ids;
        private String state;

        @NoArgsConstructor
        @Data
        public static class MergeParamsBean {

            private String force_remove_source_branch;
        }

        @NoArgsConstructor
        @Data
        public static class SourceBean {

            private Integer id;
            private String name;
            private String description;
            private String web_url;
            private Object avatar_url;
            private String git_ssh_url;
            private String git_http_url;
            private String namespace;
            private Integer visibility_level;
            private String path_with_namespace;
            private String default_branch;
            private String ci_config_path;
            private String homepage;
            private String url;
            private String ssh_url;
            private String http_url;
        }

        @NoArgsConstructor
        @Data
        public static class TargetBean {

            private Integer id;
            private String name;
            private String description;
            private String web_url;
            private Object avatar_url;
            private String git_ssh_url;
            private String git_http_url;
            private String namespace;
            private Integer visibility_level;
            private String path_with_namespace;
            private String default_branch;
            private String ci_config_path;
            private String homepage;
            private String url;
            private String ssh_url;
            private String http_url;
        }

        @NoArgsConstructor
        @Data
        public static class LastCommitBean {

            private String id;
            private String message;
            private String title;
            private String timestamp;
            private String url;
            private AuthorBean author;

            @NoArgsConstructor
            @Data
            public static class AuthorBean {

                private String name;
                private String email;
            }
        }
    }
}
